import Vue from 'vue'
import VueRouter from 'vue-router'

import index from "../components/index.vue"
import Result from "../views/Result";
import NewSongs from "../views/NewSongs";
import NewMv from "../views/NewMv";
import Mv from "../views/Mv";
import Discovery from "../views/Discovery";
import Recommend from "../views/Recommend";
import List from "../views/List";
import Login from "../views/Login";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Login
  },
  {
    path: '/index',
    redirect: '/discovery',
    component: index,
    children: [
      {
        path: '/discovery',
        component: Discovery
      },
      {
        path: '/result/:search',
        component: Result,
        name: 'searchResult',
        props: true // 开启路由传参
      },
      {
        path:'/recommend',
        component:Recommend
      },
      {
        path:'/newsongs',
        component:NewSongs
      },
      {
        path:'/newmv',
        component:NewMv
      },
      {
        path:'/mv/:id',
        component:Mv,
        name: 'playMv',
        props: true // 开启路由传参
      },
      {
        path:'/list/:id',
        component:List,
        name: 'playList',
        props: true // 开启路由传参
      },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
